jQuery(document).ready(function() { jQuery.ajax({ url: 'https://freegeoip.net/json/', dataType: 'jsonp', cache: true, jsonp: 'callback', success: function(data) { if (data.country_code == 'BR') { //jQuery('#result').append('

Pais: ' + data.country_code + '
IP: ' + data.ip + '
LatLng: ' + data.latitude + ', ' + data.longitude); var pais = 'https://pplware.sapo.pt/parceiros/banner_kk/' + data.country_code + '_pplware-comparador-v28.gif'; //jQuery('#a_pais').off('click'); jQuery('#a_pais').attr('onclick', ''); jQuery('#a_pais').attr('onclick', "recordOutboundLink(this, 'Outbound Links', 'www.comparador-precos.com.br')"); jQuery('#a_pais').attr('href', 'http://www.comparador-precos.com.br'); jQuery('#pais').attr('src',pais); } else { jQuery('#result').append('PT'); } }, error: function() { //jQuery('#result').append('

Pais: ' + data.country_code + '
IP: ' + data.ip + '
LatLng: ' + data.latitude + ', ' + data.longitude); var pais = 'https://pplware.sapo.pt/parceiros/banner_kk/pplware-comparador-v28.gif'; //jQuery('#a_pais').off('click'); jQuery('#a_pais').attr('onclick', ''); jQuery('#a_pais').attr('onclick', "recordOutboundLink(this, 'Outbound Links', 'comprarador_precos_KK)"); jQuery('#a_pais').attr('href', 'http://pplware.sapo.pt/comparador-de-precos-kuantokusta/'); jQuery('#pais').attr('src',pais); } }); });